|
The HTTP response status code 301 Moved Permanently is used for permanent URL redirection, meaning current links or records using the URL that the response is received for should be updated. The new URL should be provided in the Location field included with the response. (RFC 2616 ) states that: * If a client has link-editing capabilities, it should update all references to the Request URL. * The response is cachable.〔How long do browsers cache HTTP 301s? - http://stackoverflow.com/questions/9130422/how-long-do-browsers-cache-http-301s〕 * Unless the request method was HEAD, the entity should contain a small hypertext note with a hyperlink to the new URL(s). * If the 301 status code is received in response to a request of any type other than GET or HEAD, the client must ask the user before redirecting. ==Example== Client request:
Server response:
Here is an example using a htaccess file to redirect to a non www with a SSL attached to the domain. RewriteEngine On Here is an example using a PHP redirect. header("HTTP/1.1 301 Moved Permanently"); Equivalently simple for an nginx configuration. location /old/url/ 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「HTTP 301」の詳細全文を読む スポンサード リンク
|